<!doctype html>
<html class="no-js" manifest="__PUBLIC__/home/manifest/test.manifest">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <title>报名表单</title>
    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">
    <!-- No Baidu Siteapp-->
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!-- Add to homescreen for Chrome on Android -->
    <meta name="mobile-web-app-capable" content="yes">
    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="绵阳中学英才学校" />
    <!-- Tile icon for Win8 (144x144 + tile color) -->
    <meta name="msapplication-TileColor" content="#0e90d2">
    <link rel="stylesheet" href="__PUBLIC__/home/css/amazeui.min.css">
    <link rel="stylesheet" href="__PUBLIC__/home/css/contribute.css">
    <link rel="stylesheet" href="__PUBLIC__/home/css/registrationform.css">
</head>
<body>
    <!-- 头部 -->
    <header data-am-widget="header" class="am-header am-header-default">
      <div class="am-header-left am-header-nav">
        <a href="javascript:history.go(-1);" class="am-header-left1">
          <img src="__PUBLIC__/home/images/back.png" alt="">
        </a>
      </div>

      <h3 class="am-header-title">
          <a href="#title-link" class="">
            填写报名表
          </a>
      </h3>

      <div class="am-header-right am-header-nav index_denglu">
        <if condition="$_SESSION['login'] eq 1" >
        <a href="{:U('User/user_center')}" class="am-header-right1">
         	 个人中心
        </a>
       	<else/>
       	<a href="{:U('Login/login')}" class="am-header-right1">
         	 登录
        </a>
        </if>
      </div>
    </header>

    <!-- 中间 -->
    <div class="content">
      <div class="content1">标注*为必填项</div>
      <form action="{:U('Enroll/write_form')}" method="post" enctype="multipart/form-data">
        <div class="content2">
          <div class="content2_title am-g content2_title_out">
              <div class="am-u-sm-5">
                <div>
                  <span>*</span> <h3>学生照片</h3><br>
                  (正面免冠头像)
                </div>
              </div>
              <!-- 添加头像 -->
              <div id="file" class="am-u-sm-7 file_right">
                <img src="__PUBLIC__/home/images/upload.png" alt="" class="filebtn" id="filebtn" />
                <input type="file" accept="image/*"  capture="camera"  class="upfile" id='upfile' name="upfile"  /> 
                <!--<input id='upfile' class="upfile" name="upfile" type="file" />-->
              </div>
              <div id="pic_url">
              	<input type="hidden" name="pic_url" value="">
              </div>
          </div>
        </div>
        <div class="content3">
          <div class="content2_title am-g">
              <div class="am-u-sm-3">
                <div><span>*</span> <h3>姓&nbsp;名</h3></div>
              </div>
              <div class="am-u-sm-9">
                <input name="name" type="text">
              </div>
          </div>
          <div class="content2_title am-g">
              <div class="am-u-sm-5">
                <div><span>*</span><h3>性&nbsp;别</h3></div>
              </div>
              <div class="am-u-sm-7 am-u-sm-7true">
                <select name="sex">
                  <option value="1">男</option>
                  <option value="0">女</option>
                </select>
              </div>
          </div>
          <div class="content2_title am-g">
              <div class="am-u-sm-3">
                <div><span>*</span><h3>民&nbsp;族</h3></div>
              </div>
              <div class="am-u-sm-9 mingzu">
                <select name="nation">
                  <option value="1">汉族</option>
                  <option value="2">少数民族</option>
                </select>
              </div>
          </div>
          <div class="content2_title am-g">
              <div class="am-u-sm-3">
                <div><span>*</span><h3>身份证</h3></div>
              </div>
              <div class="am-u-sm-9">
                <input name="id_card" type="text">
              </div>
          </div>
          <div class="content2_title am-g">
              <div class="am-u-sm-3">
                <div><span>*</span> <h3>年&nbsp;制</h3></div>
              </div>
              <div class="am-u-sm-9 am-u-sm-9nianji">
                <select name="year">
                  <option value="1">三年制</option>
                  <option value="2">四年制</option>
                </select>
              </div>
          </div>
          <div class="content2_title am-g">
              <div class="am-u-sm-5">
                <div><span>*</span> <h3>招生片区</h3></div>
              </div>
              <div class="am-u-sm-7 am-u-sm-7pianqu j_select">
                <div>
                  <select id="cmbProvince" runat="server" name="s_province">
                  </select>
                </div>
                <div>
                  <select id="cmbCity" runat="server" name="s_city">
                  </select>
                </div>
                <div>
                  <select id="cmbArea" runat="server" name="s_county">
                  </select>
                </div>
              </div>
          </div>
          <div class="content2_title am-g">
              <div class="am-u-sm-5">
                <div><span>*</span> <h3>是否教师子女</h3></div>
              </div>
              <div class="am-u-sm-7 am-u-sm-7true">
                <select name="teacher_child">
                  <option value="1">是</option>
                  <option value="2">否</option>
                </select>
              </div>
          </div>
          <div class="content2_title am-g">
              <div class="am-u-sm-5">
                <div><span>*</span> <h3>户籍所在地</h3></div>
              </div>
              <div class="am-u-sm-7">
                <input name="household_register" type="text">
              </div>
          </div>
          <div class="content2_title am-g">
              <div class="am-u-sm-5">
                <div><span>*</span> <h3>家庭住址</h3></div>
              </div>
              <div class="am-u-sm-7">
                <input name="address" type="text">
              </div>
          </div>
          <div class="content2_title am-g">
              <div class="am-u-sm-4">
                <div><span>*</span><h3>父亲电话</h3></div>
              </div>
              <div class="am-u-sm-8">
                <input name="father_phone" type="tell">
              </div>
          </div>
          <div class="content2_title am-g content2_title_out">
              <div class="am-u-sm-4">
                <div><span>*</span><h3>母亲电话</h3></div>
              </div>
              <div class="am-u-sm-8">
                <input name="mother_phone" type="tell">
              </div>
          </div>
        </div>
        <div class="content3">
          <div class="content2_title am-g">
              <div class="am-u-sm-5">
                <div><h3>父/母&nbsp;亲姓名</h3></div>
              </div>
              <div class="am-u-sm-7">
                <input name="parent_name" type="text">
              </div>
          </div>
          <div class="content2_title am-g content2_title_out">
              <div class="am-u-sm-4">
                <div><h3>工作单位</h3></div>
              </div>
              <div class="am-u-sm-8">
                <input name="work_place" type="text">
              </div>
          </div>
        </div>
        <div class="content3">
          <div class="content2_title am-g content2_title_out">
              <div class="am-u-sm-12">
                <div class="am-u-sm-12">
                  <h3 class="am-u-sm-4">学生获得奖项</h3>
                  <h3 class="chuan_tupian am-u-sm-8">(上传图片)</h3>
                </div>
              </div>
              <div class="am-u-sm-12 suoyou_img">
                <!-- 添加后显示的图片 -->
                <div class="prize">
                  <input type="hidden" name="prize" value="">
                </div>
                <!-- 添加图片 -->
                <div id="file" class="am-u-sm-4">
                  <img src="__PUBLIC__/home/images/shangchuan.png" alt="" class="filebtn"/>
                  <input accept="image/*"  capture="camera" class='upfile' id="prize_pic" name="prize_pic" type="file" multiple/>
                </div>
              </div>
          </div>
        </div>
        <div class="content3">
          <div class="content2_title am-g content2_title_out">
              <div class="am-u-sm-12">
                <div class="am-u-sm-12">
                  <h3 class="am-u-sm-12">三年成绩单(四、五、六年级期末成绩)</h3>
                  <h3 class="chuan_tupian am-u-sm-12">(上传图片)</h3>
                </div>
              </div>
              <div class="am-u-sm-12 suoyou_img">
                <!-- 添加后显示的图片 -->
                <div class="ach">
                  <input type="hidden" name="achievement" value="" >
                </div>
                <!-- 添加图片 -->
                <div id="file" class="">
                  <img src="__PUBLIC__/home/images/shangchuan.png" alt="" class="filebtn"/>
                  <input accept="image/*"  capture="camera" class='upfile' id="ach" name="ach" type="file" multiple/>
                </div>
              </div>
          </div>
        </div>
        <div class="content3">
          <div class="am-g content3_submit">
            <button type="submit" onclick="return check_form()" class="am-u-sm-11 am-u-sm-centered">提交报名表</button>
          </div>
        </div>
      </form>
      <div class="content3">
        <div class="am-g content3_zhusi">
          <div class="am-u-sm-11">【注】:提交报名表单将会跳转至支付页面,请确认已登录</div>
        </div>
      </div>
      </div>
    </div>

    <script src="__PUBLIC__/home/js/jquery.min.js"></script>
    <script src="__PUBLIC__/home/js/amazeui.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/home/js/jquery.ui.widget.js" charset="utf-8"></script>
    <script type="text/javascript" src="__PUBLIC__/home/js/jquery.iframe-transport.js"></script>
    <script type="text/javascript" src="__PUBLIC__/home/js/jquery.fileupload.js"></script>
    <script type="text/javascript" src="__PUBLIC__/home/js/area.js"></script>
    <script>
      addressInit('cmbProvince', 'cmbCity', 'cmbArea');
    	//表单验证
    	function check_form(){
    		var reg_id = /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/;//18位身份验证
    		var reg_phone = /^1[3|4|5|7|8]\d{9}$/;//手机验证
    		if($("input[name=pic_url]").val() == ''){
    			alert('请选择头像');return false;
    		}
    		if($("input[name=name]").val() == ''){
    			alert('请填写姓名');
    			$("input[name=name]").focus();
    			return false;
    		}
    		if($("input[name=nation]").val() == ''){
    			alert('请填写民族');
    			$("input[name=nation]").focus();
    			return false;
    		}
    		if(!reg_id.test($("input[name=id_card]").val())){
    			alert('请输入正确的身份证号');
    			$("input[name=id_card]").focus();
    			return false;
    		}
    		if($("select[name=s_city] option:selected").val()=='市辖区'){
    			alert('请选择市');
    			$("select[name=s_city]").focus();
    			return false;
    		}
    		if($("select[name=s_county] option:selected").val()=='市辖区'){
    			alert('请选择县（区）');
    			$("select[name=s_county]").focus();
    			return false;
    		}
    		if($("input[name=household_register]").val() == ''){
    			alert('请填户籍所在地');
    			$("input[name=household_register]").focus();
    			return false;
    		}
    		if(!reg_phone.test($("input[name=father_phone]").val())){
    			alert('请填写正确的父亲电话');
    			$("input[name=father_phone]").focus();
    			return false;
    		}
    		if(!reg_phone.test($("input[name=mother_phone]").val())){
    			alert('请填写正确的母亲电话');
    			$("input[name=mother_phone]").focus();
    			return false;
    		}
    		if($("input[name=address]").val() == ''){
    			alert('请写家庭住址');
    			$("input[name=address]").focus();
    			return false;
    		}
    		
    		return true;
    	}
        $(function(){
        	 $('.upfile').change(function(){
                 $('#filetxt').val($('.upfile').val());
              });
          //学生照片异步上传
      	$('#upfile').fileupload({
            dataType: 'json',//数据类型：json
            url: '__APP__/Enroll/upload',//上传地址
            formData: {name:'upfile'},
            add: function (e,data) {
                data.submit();
            },
            done: function (e,data) {
                var param = data.result;
                console.log(param);
               if (typeof(param.error) != 'undefined') {
                    alert(param.error);//弹出错误
                }else{
                		var leng = param[0].savepath.length-1;
                		var html="<input type='hidden' name='pic_url' value='"+param[0].savepath.substr(1,leng)+param[0].savename+"' />";
                		$('#filebtn').attr('src','__ROOT__'+param[0].savepath.substr(1,leng)+param[0].savename);//显示上传的图片
                		$('#pic_url').html(html);
               }
            }
        });
          //获奖图片异步上传
      	$('#prize_pic').fileupload({
            dataType: 'json',//数据类型：json
            url: '__APP__/Enroll/upload',//上传地址
            formData: {name:'prize_pic'},
            add: function (e,data) {
            	$("input[name=prize]").remove();
                data.submit();
            },
            done: function (e,data) {
                var param = data.result;
               if (typeof(param.error) != 'undefined') {
                    alert(param.error);//弹出错误
                }else{
                		var leng = param[0].savepath.length-1;
                		var html="<div class='file'><img src='__PUBLIC__/home/images/Delete.png' class='Delete_img'/><img src='__ROOT__"+param[0].savepath.substr(1,leng)+param[0].savename+"' />"+"<input type='hidden' name='prize[]' value='"+param[0].savepath.substr(1,leng)+param[0].savename+"' /></div>";
                		$('.prize').after(html);
               }
               $(".Delete_img").on('click',function(){
                   $(this).parent().remove();
                });
            }
        });
      //成绩图片异步上传
      	$('#ach').fileupload({
            dataType: 'json',//数据类型：json
            url: '__APP__/Enroll/upload',//上传地址
            formData: {name:'ach'},
            add: function (e,data) {
            	$("input[name=achievement]").remove();
                data.submit();
            },
            done: function (e,data) {
                var param = data.result;
               if (typeof(param.error) != 'undefined') {
                    alert(param.error);//弹出错误
                }else{
                		var leng = param[0].savepath.length-1;
                		var html="<div class='file'><img src='__PUBLIC__/home/images/Delete.png' class='Delete_img'/><img src='__ROOT__"+param[0].savepath.substr(1,leng)+param[0].savename+"' />"+"<input type='hidden' name='achievement[]' value='"+param[0].savepath.substr(1,leng)+param[0].savename+"' /></div>";
                		$('.ach').after(html);
               }
                $(".Delete_img").on('click',function(){
                   $(this).parent().remove();
                });
            }
        });

       });
    </script>
</body>

</html>
